package com.wn32.main.demo6;


import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Main5 {
    public static void main(String[] args) {
       Runnable r=()->{
           for (int i = 0; i <10 ; i++) {
               System.out.println(Thread.currentThread().getName()+":"+i);
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   e.printStackTrace();
               }
           }
       };
        ExecutorService executorService = Executors.newCachedThreadPool();
        executorService.execute(r);
        executorService.execute(r);
        executorService.execute(r);
        executorService.execute(r);
        executorService.execute(r);

        System.out.println(Thread.currentThread().getName()+":蜗牛学院");
    }
}
